%removing centroid and scaling it to unit norm
function pshape = getPreShape( contour )
%calculate centroid
[yd xd] = size(contour(1,:));
centroid = [sum(contour(1,:))/xd sum(contour(2,:))/xd];
%rescale shape to equal size, Frobenius norm
S = sqrt( sum((contour(1,:)-centroid(1)).^2) + sum((contour(2,:)-centroid(2)).^2) );
pshape = (contour-repmat(centroid',1,xd))*(1/S);
%scatter(pshape(1,:),pshape(2,:),'.')
